/// @cond ETM_Internal
/**
  Main initialisation routine.
  @param none
  @author Martin Pallesch
  @version 1.0
  @return nothing
*/
void invokedAESUserFunc(string shapeName, int screenType, int tabType, int row, int column, string value, mapping mTableRow)
{

  // zhigang-li@siemens.com
  // 添加一个函数LIB_UI_Ack()，处理本地 UI\中央UI 的分别进行的报警确认与点击动作

  // 遍历报警表格，获得列的name
  int iColumnCount;
  getValue("table_top", "columnCount", iColumnCount);
  dyn_string dsHeaderName;

  for (int i = 0; i < iColumnCount ; i++)
  {
    dynAppend(dsHeaderName,  table_top.columnToName(i));
  }

  if (column == dynContains(dsHeaderName, "localAck") )
  {

    // DebugN("localAck", mTableRow);
    atime ti = mTableRow[_TIME_];
    string sJson;
    // 格式：
    // {"UI":["UI1","UI2"]}
    string sComment;
    getValue("table_top", "cellValueRC", row, "__V_comments", sComment);


    // 解析
    mapping mComment = jsonDecode(sComment);
    dyn_string dsUI;

    if (mappingHasKey(mComment, "UILocal"))
    {
      dsUI  = mComment["UILocal"];
      dynAppend(dsUI, myUiNumber());
    }
    else
    {
      dynAppend(dsUI, myUiNumber());
    }

    mComment["UILocal"] = dsUI;
    sJson = jsonEncode(mComment);
    int ret = alertSet(ti, getACount(ti), dpSubStr(getAIdentifier(ti), DPSUB_SYS_DP_EL_CONF_DET) + "._comment", sJson);
  }

  if (column == dynContains(dsHeaderName, "centerAck") )
  {

    // DebugN("centerAck", mTableRow);
    atime ti = mTableRow[_TIME_];
    string sJson;
    // 格式：
    // {"UI":["UI1","UI2"]}
    string sComment;
    getValue("table_top", "cellValueRC", row, "__V_comments", sComment);


    // 解析
    mapping mComment = jsonDecode(sComment);
    dyn_string dsUI;

    if (mappingHasKey(mComment, "UICenter"))
    {
      dsUI  = mComment["UICenter"];

      if (!dynContains(dsUI, myUiNumber()))
      {
        dynAppend(dsUI, myUiNumber());
      }
    }
    else
    {
      dynAppend(dsUI, myUiNumber());
    }

    mComment["UICenter"] = dsUI;
    sJson = jsonEncode(mComment);
    int ret = alertSet(ti, getACount(ti), dpSubStr(getAIdentifier(ti), DPSUB_SYS_DP_EL_CONF_DET) + "._comment", sJson);

  }

  // DebugN("invokedAESUserFunc() - shape=" + shapeName + " column=" + column + " row=" + row + " tableRow" + mTableRow);
}
/// @endcond
